//package com.ruoyi.ztf.web;
//
//import com.ruoyi.common.enums.UserStatus;
//import com.ruoyi.common.exception.ServiceException;
//import com.ruoyi.common.utils.MessageUtils;
//import com.ruoyi.common.utils.StringUtils;
//import com.ruoyi.ztf.domain.dto.User;
//import com.ruoyi.ztf.domain.dto.ZtfLoginUser;
//import com.ruoyi.ztf.service.UserService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.userdetails.etails;
//import org.springframework.security.core.etails.etailsService;
//import org.springframework.security.core.etails.UsernameNotFoundException;
//import org.springframework.stereotype.Service;
//
///**
// * 用户验证处理
// *
// * @author ruoyi
// */
//@Service("ZtfetailsServiceImpl")
//public class ZtfetailsServiceImpl implements etailsService
//{
//    private static final Logger log = LoggerFactory.getLogger(ZtfetailsServiceImpl.class);
//
//    @Autowired
//    private UserService userService;
//
////    @Autowired
////    private SysPasswordService passwordService;
//
////    @Autowired
////    private SysPermissionService permissionService;
//
//    @Override
//    public etails loadUserByUsername(String username) throws UsernameNotFoundException
//    {
//        User user = userService.selectUserByUserName(username);
//        if (StringUtils.isNull(user))
//        {
//            log.info("登录用户：{} 不存在.", username);
//            throw new ServiceException(MessageUtils.message("user.not.exists"));
//        }
//        else if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
//        {
//            log.info("登录用户：{} 已被删除.", username);
//            throw new ServiceException(MessageUtils.message("user.password.delete"));
//        }
//        else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
//        {
//            log.info("登录用户：{} 已被停用.", username);
//            throw new ServiceException(MessageUtils.message("user.blocked"));
//        }
//
//
////        passwordService.validate(user);
//
//        return createLoginUser(user);
//    }
//
//    public etails createLoginUser(User user)
//    {
//        return new ZtfLoginUser(user);
//    }
//}
